home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 3.3 KB | 141 lines | [TEXT/ToyS] |
- -- Preferences
- property kasPrefName : "File Info"
- property kasFontName : "Monaco"
- property kasFontSize : 9
- property kasTickerInit : 8
-
- -- Globals
- global gasInfoWind -- Info window
- global gasInfoPos -- Position of info window
- global gasTicker -- How many idles until quit
- global gasRunning -- Running?
-
-
- on open fsObjs
- try
- set gasRunning to gasRunning + 1
- on error
- set gasRunning to 1
-
- pfLoad()
-
- set gasInfoWind to display info titled kasPrefName ¬
- located at gasInfoPos
- end try
-
- set gasTicker to kasTickerInit
-
- repeat with fsObj in fsObjs
- ShowInfo(fsObj)
- pause for 3 with seconds timing
- end repeat
- end open
-
-
- on quit
- -- Save Screen Location of info window if changed
- try
- set infoPos to screen location of ¬
- (display info gasInfoWind with disposal)
- if (infoPos is not gasInfoPos) then
- set gasInfoPos to infoPos
- pfSave()
- end if
- set gasRunning to "X"
- on error
- beep
- end try
- continue quit
- end quit
-
-
- on idle
- set gasTicker to gasTicker - 1
- if (gasTicker is 0) then quit
- return 15
- end idle
-
-
- on ShowInfo(fsObj)
- set xInfo to extended info for fsObj
- set aInfo to alias info from fsObj
-
- set lineNo to 1
-
- if (catalog kind of xInfo is a folder) then
- set fKind to "Folder"
- else if (catalog kind of xInfo is an alias) then
- set fKind to "Alias"
- else if (catalog kind of xInfo is a file) then
- set fKind to "File"
- else
- set fKind to "Unknown"
- end if
-
- set lineNo to ShowLine("Name", catalog name of xInfo, lineNo)
- set lineNo to ShowLine("Kind", fKind, lineNo)
- set lineNo to ShowLine("Type", system type of xInfo, lineNo)
- set lineNo to ShowLine("Creator", system creator of xInfo, lineNo)
- set lineNo to ShowLine("Created", (catalog creation date of xInfo) as string, lineNo)
- set lineNo to ShowLine("Modified", (catalog modification date of xInfo) as string, lineNo)
- -- set lineNo to ShowLine("Backed up", (catalog archival date of xInfo) as string, lineNo)
-
- if (fKind is "Folder") then
- set lineNo to ShowLine("Items", number of items within of xInfo, lineNo)
- set lineNo to ShowLine("View", finder view setting of xInfo, lineNo)
- else
- set lineNo to ShowLine("Data Len", GigaStr(data fork length of xInfo), lineNo)
- set lineNo to ShowLine("Rsrc Len", GigaStr(resource fork length of xInfo), lineNo)
- end if
- end ShowInfo
-
-
- on ShowLine(label, parm, lineNo)
- display info gasInfoWind ¬
- message (PadStr(label & ":", 10, false) & parm) ¬
- at line lineNo ¬
- using font kasFontName ¬
- using size kasFontSize
-
- return lineNo + 1
- end ShowLine
-
-
- on GigaStr(n)
- if (n > 1024 * 1024 * 1024 * 2) then -- > 2 GB?
- set freeK to "" & ((0.0 + (round (n / (1024 * 1024 * 102.4)))) / 10) & " GB"
- else if (n > 1024 * 1024 * 2) then -- > 2 MB?
- set freeK to "" & ((0.0 + (round (n / (1024 * 102.4)))) / 10) & " MB"
- else if (n > 1024 * 2) then -- > 2 MB?
- set freeK to "" & ((0.0 + (round (n / (102.4)))) / 10) & " KB"
- else
- set freeK to "" & n & " B"
- end if
- end GigaStr
-
-
- on PadStr(str, len, atLeft)
- set pad to " "
-
- if atLeft then
- return the text from character -1 to -len of (pad & str)
- else
- return the text from character 1 to len of (str & pad)
- end if
- end PadStr
-
-
- on pfLoad()
- try
- set ourPrefs to (load preference named kasPrefName)
- set gasInfoPos to item 1 of ourPrefs
- on error
- set gasInfoPos to {-1, -1}
- end try
- end pfLoad
-
-
- on pfSave()
- save preference {gasInfoPos} named kasPrefName
- end pfSave
-